package com.zhaowb.springcloud.gate.rpc;

import com.zhaowb.springcloud.api.vo.authority.PermissionInfo;
import com.zhaowb.springcloud.api.vo.user.UserInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * Created with IDEA
 *
 * @author zhaowb
 * @date 2018/11/9 16:36
 */
@FeignClient("cloud-admin")
@RequestMapping("api")
@Repository
public interface IUserService {
    /**
     * 根据用户名查询用户信息
     *
     * @param username 用户名
     * @return
     */
    @RequestMapping(value = "/user/username/{username}", method = RequestMethod.GET)
    UserInfo getUserByUsername(@PathVariable("username") String username);

    /**
     * 根据用户名查询权限
     *
     * @param username 用户名
     * @return
     */
    @RequestMapping(value = "/user/un/{username}/permissions", method = RequestMethod.GET)
    List<PermissionInfo> getPermissionByUsername(@PathVariable("username") String username);

    /**
     * 查询所有权限信息
     *
     * @return
     */
    @RequestMapping(value = "permissions", method = RequestMethod.GET)
    List<PermissionInfo> getAllPermission();
}
